package com.jiayang.hhotel.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jiayang.hhotel.R;
import com.jiayang.hhotel.bean.BuildNoModel;

import butterknife.BindView;
import cn.droidlover.xdroidmvp.base.SimpleRecAdapter;
import cn.droidlover.xdroidmvp.imageloader.ILFactory;
import cn.droidlover.xdroidmvp.kit.KnifeKit;

/**
 * Created by Administrator on 2017/5/4 0004.
 */

public class BuildNoAdapter extends SimpleRecAdapter<BuildNoModel.BldgListBean,BuildNoAdapter.ViewHolder>{
    public BuildNoAdapter(Context context) {
        super(context);
    }

    @Override
    public int getLayoutId() {
        return R.layout.adapter_buildno;
    }

    @Override
    public ViewHolder newViewHolder(View itemView) {

        return new ViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, final int position) {
        final BuildNoModel.BldgListBean item = data.get(position);
        ILFactory.getLoader().loadNet(holder.build_no_iv, item.getPhotoPath(), null);
            holder.build_no_code.setText(item.getCode());
            holder.build_no_chi.setText(item.getChnDescp());
            holder.build_no_eng.setText(item.getEngDescp());
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (getRecItemClick()!=null){


                    }
                }
            });
    }

    public static class ViewHolder extends RecyclerView.ViewHolder{
        ImageView build_no_iv;
        TextView build_no_code;
        TextView build_no_chi;
        TextView build_no_eng;

        public ViewHolder(View itemView) {
            super(itemView);
            build_no_iv=(ImageView)itemView.findViewById(R.id.build_no_iv);
            build_no_code=(TextView) itemView.findViewById(R.id.build_no_code);
            build_no_chi=(TextView)itemView.findViewById(R.id.build_no_chi);
            build_no_eng=(TextView)itemView.findViewById(R.id.build_no_eng);
        }
    }
}
